/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.pima.gestrest.model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Transient;

/**
 *
 * @author Pierre-Louis Conte
 */


@NamedQuery(name = Cuisine.FIND_ALL, query = "SELECT b FROM Cuisine b")
@Entity
public class Cuisine implements Serializable {

   public final static String FIND_ALL = "Cuisine.findAll";
   public final static String Del_SOM = "Cuisine.delete";

  @Id
    @GeneratedValue
    private Long id;
    private String title;
    @Column(length = 100)
    private String region;
    @Column(length = 100)
    private String type;
    @Column(length = 100)
    private String img;
    @Column(length = 1000)
    private String description;

    @Transient
    private Boolean selected;

    public Cuisine()
    {
    }

    public Cuisine(String region, String type, String img, String description)
    {
        this.region = region;
        this.type = type;
        this.description = description;
        this.img = img;

    }

    // ======================================
    // =          Getters & Setters         =
    // ======================================
    public Long getId() {
        return id;
    }

    public String getTitle() {
        return this.title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public Boolean isSelected() {
        return selected;
    }

    public Boolean getSelected() {
        return selected;
    }

    public void setSelected(Boolean selected) {
        this.selected = selected;
    }

    // ======================================
    // =         hash, equals, toString     =
    // ======================================

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("Cuisine");
        sb.append("{id=").append(id);
        sb.append(", title='").append(title).append('\'');
        sb.append(", region='").append(region).append('\'');
        sb.append(", type='").append(type).append('\'');
        sb.append(", description='").append(description).append('\'');
        sb.append(", img='").append(img).append('\'');
        sb.append('}');
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
       if(((Cuisine)obj).getTitle().equals(title) && ((Cuisine)obj).getId().equals(id))
            return true;
        else
            return false;
    }


}
